package com.gexin.model.activity;

import com.gexin.model.activity.base.BaseMemberCoinLog;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.UUID;

/**
 * 业务名称:  t_member_coin_log() 
 */
@SuppressWarnings("serial")
public class MemberCoinLog extends BaseMemberCoinLog<MemberCoinLog> {
	public static final MemberCoinLog dao = new MemberCoinLog();

    public List<MemberCoinLog> findByByUserId(String id) {
        return MemberCoinLog.dao.find("select * from t_member_coin_log where user_id="+id+
        " order by create_time desc");
    }

    public void setCommonUserIdAndCoinAndCoinIncrementAndIncomeOrAndTypeAndDesc(
            String authUserId, String presentId, String mainPresentId, int type,
            BigDecimal coinMine, BigDecimal coin, int comeor, String desc) {
        this.setId(UUID.randomUUID()+"");
        this.setUserId(authUserId);
        this.setPresentId(presentId);
        this.setMainPresentId(mainPresentId);

        this.setCoin(coinMine);
        this.setIncrementCoin(coin);
        this.setIncomeOr(comeor);
        this.setDesc(desc);

        long date = new Date().getTime();
        this.setCreateTime(date);
        this.setUpdateTime(date);
    }
}
